package org.nepu.srr.设备设施资料.井控设备证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;

import javax.persistence.Column;
import javax.persistence.Convert;

@Data
public class B44WellControlParams {
    @ApiModelProperty("防喷器及四通阀门组")
    CommonIn ventValveGroup;

    @ApiModelProperty("防喷器吊")
    CommonIn antiSprayDeviceCrane;

    @ApiModelProperty("防喷器储能控制系统")
    CommonIn ventValveControlSystem;

    @ApiModelProperty("防喷器主辅控制面板")
    CommonIn ventValveMainAuxControlPanel;

    @ApiModelProperty("防喷器控制系统储能瓶组")
    CommonIn ventValveControlSystemBatteryGroup;

    @ApiModelProperty("阻流压井管汇及控制台")
    CommonIn pressureVentPipeAndControlConsole;

    @ApiModelProperty("鹅颈管及阻流压井软管")
    CommonIn egressValveAndPressureVentSoftPipe;

    @ApiModelProperty("节流压井管汇")
    CommonIn flowControlVentPipe;

    @ApiModelProperty("液气分离器、分流器、铠装高压软管")
    CommonIn gasSeparateValveAndFlowValveAndSteelPipe;

    public  B44WellControlResult rate(){
        double fullScore = 90;
        double score = 0;
        if(CommonMethods.isAllTrue(ventValveGroup.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(antiSprayDeviceCrane.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(ventValveControlSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(ventValveMainAuxControlPanel.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(ventValveControlSystemBatteryGroup.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(pressureVentPipeAndControlConsole.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(egressValveAndPressureVentSoftPipe.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(flowControlVentPipe.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(gasSeparateValveAndFlowValveAndSteelPipe.getInput())){
            score += 10;
        }
        double rate = score/fullScore;
        B44WellControlResult result = new B44WellControlResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
